﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decal.Adapter;
using Decal.Adapter.Wrappers;

namespace InspectorGadget
{
    public abstract class Monitor
    {
        /// <summary>
        /// A callback that the monitor will call when it is triggered. A monitor will
        /// only have one callback, and it can only be set on the register event.
        /// </summary>
        /// <param name="MonitorID">Must be the value the monitor provides as MonitorID</param>
        /// <param name="diagnostics">A string describing the event (human readable).</param>
        public delegate void callback(string MonitorID, string diagnostics);
        protected Monitor.callback m_callback;

        /// <summary>
        /// True if shallow inspection of event arguments should be performed.
        /// </summary>
        protected bool m_inspect;
        /// <summary>
        /// Turn on/off shallow inspection of event arguments in diagnostic output.
        /// </summary>
        public bool inspect
        {
            get { return m_inspect; }
            set { m_inspect = value; }
        }

        /// <summary>
        /// True if a copy of the functions should be sent to a thread for putting in breakpoints -
        /// hopefully allow inspection in the debugger without stalling decal and possibly AC.
        /// </summary>
        protected bool m_bpt;
        /// <summary>
        /// Turn on/off putting variables in a breakpoint observation thread.
        /// </summary>
        public bool breakpointthread
        {
            get { return m_bpt; }
            set { m_bpt = value; }
        }

        /// <summary>
        /// Get the unique identifier of the monitor
        /// </summary>
        public abstract string MonitorID { get; }
        /// <summary>
        /// Turn on the montor to send alerts
        /// </summary>
        public abstract void register(Monitor.callback callback);
        /// <summary>
        /// Turn off the monitor - no alerts
        /// </summary>
        public abstract void unregister();
    }
}
